package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.Dimension;
import com.red.star.wechat.data.entity.DimensionTag;
import com.red.star.wechat.data.entity.PosterDimensionTag;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DimensionTagMapper extends MyMapper<DimensionTag> {

    @Select("select * from t_dimension")
    List<Dimension> findByDimensionId();

    @Select("SELECT count(*) FROM t_dimension_tag  ttg WHERE  ttg.`status`=0 AND ttg.`name`=#{name} AND ttg.dimension_id=#{id}")
    Integer findDimensionTagStatusOne(@Param("name") String name, @Param("id") Integer id);

    @Select("SELECT count(*) FROM t_dimension_tag  ttg WHERE  ttg.`status`=1 AND ttg.`name`=#{name} AND ttg.dimension_id=#{id}")
    Integer findDimensionTagStatusTwo(@Param("name") String name, @Param("id") Integer id);

    @Select("select * from t_dimension_tag")
    List<DimensionTag> findDimensionTagName();

    List<DimensionTag> findByEntityTag(@Param("dimensionTag") DimensionTag dimensionTag);

    Integer findDimensionTagStatusById(@Param("id") Integer id);

    void updataDimensionTagStatusById0(@Param("id") Integer id, @Param("status") Integer status);

    void updataDimensionTagStatusById(@Param("id") Integer id, @Param("status") Integer status);

    List<DimensionTag> getAllDimensionTagList(@Param("dimensionTag") DimensionTag dimensionTag);

    List<DimensionTag> findDimensionTagByDimensionId(@Param("dimensionId") Integer dimensionId, @Param("name") String name);

    DimensionTag findDimensionByDimensionIdAndName(@Param("dimensionId") Integer dimensionId, @Param("name") String name, @Param("employeeId") Integer employeeId);

    List<DimensionTag> listAllEnabledDimensionTag(@Param("employeeId") Integer employeeId);

    List<DimensionTag> findDimensionTag(@Param("id") Integer id, @Param("list") List<Integer> list);

    int addPosterDimensionTag(@Param("tagId") Integer tagId, @Param("posterId") Integer posterId, @Param("status") Integer status);

    PosterDimensionTag findPosterDimensionTag(@Param("tagId") Integer tagId, @Param("posterId") Integer posterId);

    int updatePosterDimensionTag(@Param("id") Integer id, @Param("status") Integer status);

    int updateRemoveTag(@Param("tagId") Integer tagId, @Param("posterId") Integer posterId);

    Integer findTagCount(@Param("posterId") Integer posterId);

    List<PosterDimensionTag> listPosterDimensionTag(@Param("posterId") Integer posterId);

    Integer showTagCount(@Param("posterId") Integer posterId);

    Integer deleteDimensionTagByEIdAndDId(@Param("employeeId") Integer employeeId, @Param("dimensionId") Integer dimensionId);


    List<Integer> findPosterAndDimensionTag(@Param("id") Integer id, @Param("posterId") Integer posterId);

    int updateDimensionTagStatus(@Param("posterId") Integer posterId);

    List<Integer> findPosterDimensionTagStatus(@Param("posterId") Integer posterId, @Param("status") Integer status);

    int updateDimensionTagStatusTow(@Param("list") List<Integer> list, @Param("status") Integer status);

    int deleteDimensionTagByStatus(@Param("list") List<Integer> list);

    List<Integer> findPosterDimensionTagStatusTow(@Param("posterId") Integer posterId);

    List<Integer> findPosterDimensionTagIds(@Param("posterId") Integer posterId);

    int deleteDimensionTagByIds(@Param("list") List<Integer> list);

    PosterDimensionTag findByTagIdAndPosterId(@Param("tagId") Integer tagId, @Param("posterId") Integer posterId);

    int updateDimensionTag(@Param("posterId") Integer posterId, @Param("tagId") Integer tagId, @Param("status") Integer status);

    int updateDimensionTagTow(@Param("posterId") Integer posterId, @Param("list") List<Integer> list);

    int insertDimensionTag(@Param("dimensionId") Integer dimensionId, @Param("tagName") String tagName, @Param("status") Integer status);

    DimensionTag findByDimensionAndName(@Param("dimensionId") Integer dimensionId, @Param("tagName") String tagName);

    PosterDimensionTag findByPosterIdAndTagId(@Param("tagId") Integer tagId, @Param("posterId") Integer posterId);

    List<PosterDimensionTag> findPosterDimensionTagCount(@Param("posterId") Integer posterId);
}
